<?php

namespace Home\Controller;

use Think\Controller;

class ConclusionController extends Controller {
	// 展示首页
	public function index() {
		$where['name'] = I('get.name');
		$data['mobile'] = I('get.mobile');
		$conclusion = M('conclusionuser')->where($where)->select()[0];
		//所有分享先进首页
		if (I('get.share') == 1 && I('get.jinru') != 1) {
			$conclusion['empty'] = 1;
			$this->assign('conclusion', $conclusion);
			$this->display('./H5/index.html');
			die;
		}
		//点击查看自己的总结表单
		if (I('get.chakan') == 1) {
			$conclusion['empty'] = 2;
			$this->assign('conclusion', $conclusion);
			$this->display('./H5/index.html');
			die;
		}
		//
		if (empty($where['name'])) {
			$conclusion['empty'] = 2;
			$this->assign('conclusion', $conclusion);
			$this->display('./H5/index.html');
			die;
		}
		if (empty($conclusion)) {
			//表示没有查到数据只展示首页
			$conclusion['empty'] = 2;
			$this->display('./H5/index2.html');
			die;
		} else {
			if (empty($conclusion['mobile'])) {
				M('conclusionuser')->where('conuserid=' . $conclusion['conuserid'])->save($data);
			}
			//表示有数据只展示详情页
			$conclusion['empty'] = 0;
		}
		$conclusion['km_intro'] = explode('###', $conclusion['km_intro']);
		$conclusion['hour_intro'] = explode('###', $conclusion['hour_intro']);
		$conclusion['money_intro'] = explode('###', $conclusion['money_intro']);
		$wxconfig = wx_share_init();
		$this->assign('wxconfig', $wxconfig);
		$this->assign('conclusion', $conclusion);
		$this->display('./H5/index.html');
	}
	public function wxshare() {
		$url = "/Home/conclusion/index.html?share=1&name=" . I("get.name");
		$wxconfig = wx_share_init($url);
		return $this->ajaxReturn($wxconfig);
	}
}